package com.ibeeking.found.cms.api.feign;

import com.ibeeking.found.cms.api.common.dto.GoodsCategoryDTO;
import com.ibeeking.found.cms.api.common.dto.GoodsDTO;
import com.ibeeking.found.cms.api.common.dto.GoodsGroupBaseDTO;
import com.ibeeking.found.cms.api.common.dto.GoodsVoDTO;
import com.ibeeking.found.cms.api.common.query.GoodsByGroupQuery;
import com.ibeeking.found.cms.api.common.query.ShopGoodsQtyQuery;
import com.ibeeking.found.cms.api.feign.fallback.CmsGoodsFeignCFallbackFactory;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;


/**
 * @Author ibeeking
 */
@FeignClient(name = "mall-goods-c-server", path = "/c", contextId = "cmsGoodsFeignCClient", fallbackFactory = CmsGoodsFeignCFallbackFactory.class, decode404 = true)
public interface CmsGoodsFeignCClient {

    /**
     * 根据商品id集合查询商品信息
     */
    @PostMapping(value = "/open/goods/feign/v1/listByGoods")
    ResponseResult<List<GoodsDTO>> listByGoods(@RequestBody List<Long> goodsIds);

    /**
     * 有效商品类目根列表
     *
     * @return
     */
    @PostMapping(value = "/open/goods/feign/v1/goodsCategory/effectiveRootDtoList")
    ResponseResult<List<GoodsCategoryDTO>> goodsCategoryEffectiveRootDtoList();

    /**
     * 根据商品分组查询商品
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/goods/feign/v1/queryGoodsByGroup")
    ResponseResult<List<GoodsVoDTO>> queryGoodsByGroup(@RequestBody @Validated GoodsByGroupQuery query);

    /**
     * 根据商品分组id查询商品分组信息GoodsGroupBaseDTO
     *
     * @param groupIds
     * @return
     */
    @PostMapping(value = "/goods/feign/v1/queryGoodsGroupByIds")
    ResponseResult<List<GoodsGroupBaseDTO>> queryGoodsGroupByIds(@RequestBody List<Long> groupIds);

    /**
     * 查询店铺商品数量
     * @param query
     * @return
     */
    @PostMapping(value = "/open/goods/feign/v1/queryShopGoodsQty")
    ResponseResult<Integer> queryShopGoodsQty(@RequestBody @Validated ShopGoodsQtyQuery query);

}
